﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace RookieLibSharp.Ui
{
    public partial class RookieForm : Form
    {
        public RookieForm()
        {
            InitializeComponent();
        }
        public delegate DialogResult dg_ShowMsg(string text, string caption, MessageBoxButtons buttons);
        public DialogResult ShowMsg(string text, string caption = "提醒", MessageBoxButtons buttons = MessageBoxButtons.OK)
        {
            if (this.InvokeRequired)
            {
                dg_ShowMsg method = ShowMsg;
                return (DialogResult)this.Invoke(method, text, caption, buttons);
            }
            else
            {
                return MessageBox.Show(text,caption,buttons);
            }
        }
        public delegate void dg_CloseForm();
        public void CloseForm()
        {
            if (this.InvokeRequired)
            {
                dg_CloseForm method = CloseForm;
                this.Invoke(method);
            }
            else
            {
                this.Close();
            }
        }
    }
}
